#ifndef COMMON_FUNC_H_H
#define COMMON_FUNC_H_H

#include <windows.h>

#include <string>

using std::string;
using std::wstring;

#pragma comment(lib, "gdiplus.lib")

void WSACleanExit();

bool RetryConnect(int socketFd, sockaddr_in* serverAddress);

bool SendData(int socketFd, const char* buffer, int len);
bool ReceiveData(int socketFd, char* buffer, int len, int bufferSize);

void ShowErrorMessage(const string& mess);
void ShowErrorMessage(const wstring& mess);
void PrintErrorMessage(const string& errMess);

WCHAR* CharToWChar(const char* buffer, int ccount);
char* WCharToChar(const WCHAR* buffer, int ccount);

int GetEncoderClsid(const WCHAR* format, CLSID* clsId);

#endif